<script language="c#" runat="server">
protected string Condition()
{
	string result = Alias.Link.IsDeleted + "=false and " + Alias.Link.IsChecked + "=true and " + Alias.Link.CategoryID + "='" + Request.QueryString["CategoryID"] + "'";
	if (Request.QueryString["Sort"] == "Rank")
		result += " and " + Alias.Link.AlexaRank + " > 0";
	else if (Request.QueryString["Sort"] == "Recommend")
		result += " and " + Alias.Link.Recommend + " > 0";
	else if (Request.QueryString["Sort"] == "Up")
		result += " and " + Alias.Link.Up + " > 0";
	
	if (Request.QueryString["Logo"] == "true")
		result += " and " + Alias.Link.Logo + " IS NOT NULL";
		
	return result;
}
protected string Sort()
{
	switch (Request.QueryString["Sort"])
	{
		case "UpdateTime":
			return Alias.Link.UpdateTime + " DESC";
		case "Rank":
			return Alias.Link.AlexaRank + " ASC";
		case "Recommend":
			return Alias.Link.Recommend + " DESC";
		case "Up":
			return Alias.Link.Up + " DESC";
		default:
			return Alias.Link.Hold + " DESC," + Alias.Link.UpdateTime + " DESC";
	}
}
</script>
<ali:List Object="Link" Page="1" PageSize="Request.QueryString['PageSize']" Condition="Condition()" Sort="Sort()">
	<ali:Row MaxCol="1">
		<ul>
			<ali:Col MaxRecord="5">
				<ali:Record>
					<%If Request.QueryString["Logo"] == "true"%>
						<li><a href="<%=BuildUrl()%>" target="_blank" title="<%=Name%>"><img src="<%=Logo%>" alt="<%=Name%>" /></a></li>
					<%Else%>
						<li><a href="<%=BuildUrl()%>" target="_blank" title="<%=Name%>"<%=Style%>><%=Name%></a></li>
					<%EndIf%>
				</ali:Record>
			</ali:Col>
		</ul>
	</ali:Row>
</ali:List>
